/**
 * Contains {@link Switch}
 */
package logic.pathelements;

import java.util.ArrayList;

/**
 * Switch
 * @author Alexey Akimov <frinatella@gmail.com>
 */
public class Switch extends PassiveElement {

    /**
     * this element name
     */
    protected String name;
    
    /**
     * Constructor instances this switch id, name and network interfaces according to its parameters
     * @param id this switch id
     * @param name this switch name
     * @param networkInterfacesCount this switch connectors count
     */
    public Switch(Integer id, String name, int connectorsCount) throws Exception {
        super(id, connectorsCount);
        this.name = name;
        switchRecords = new ArrayList<SwitchRecord>();
    }
    
    /**
     * switch connector to other active path element port correspondences
     */
    private ArrayList<SwitchRecord> switchRecords;
    
    /**
     * Constructor instances Ports according to getConnectorsCount result
     */


    /**
     * Adds new switchRecord
     * @param switchRecord record will be added
     */
    public void addRecord(SwitchRecord switchRecord) {
        switchRecords.add(switchRecord);
    }

    /**
     * Remove switchRecord
     * @param switchRecord record will be removed
     */
    public void removeRecord(SwitchRecord switchRecord) {
        switchRecords.remove(switchRecord);
    }

    /**
     * Getter
     * @return switch connector to other active path element port correspondences
     */
    public ArrayList<SwitchRecord> getRecords() {
        return switchRecords;
    }

    @Override
    public double getTimeDelay() {
            return 6;
    }

    @Override
    public double getCosts() {
            return 12;
    }

    @Override
    public String getInfo() {
            return "This is switch. It switches.";
    }

}
